package com.bw.mapper;

import com.bw.bean.Vo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @ClassName VoMapper
 * @description: TODO
 * @date 2025年05月12日
 * @version: 1.0
 */
@Mapper
public interface VoMapper {
    @Select("call p2;")
    Double getList1();

    @Select("select bp.name,sum(final_amount) `value` from order_info\n" +
            "left join base_province bp on order_info.province_id = bp.id\n" +
            "group by bp.name;")
    List<Vo> getList2();

    @Select("select tp.paper_title name,avg(te.score) `value` from test_exam te\n" +
            "left join test_paper tp on te.paper_id = tp.id\n" +
            "group by tp.paper_title having avg(te.score)>60;")
    List<Vo> getList3();

    @Select("select max(score),min(score),max(score)-min(score) '差值' from test_exam;")
    List<Map> getList4();

    @Select("select * from test_exam where score=(select max(score) from test_exam);")
    List<Map> getList5();

    @Select("select order_status,count(*) from order_info group by order_status;")
    List<Map> getList6();

    @Select("select bp.name,count(distinct user_id) `value` from order_info oi\n" +
            "left join base_province bp on oi.province_id = bp.id\n" +
            "group by bp.name having value>10000;")
    List<Map> getList7();


}
